import { post } from '@/request/http'
import { toString } from '@/utils/utils'
import store from '@/store'

// 代码表管理 接口


// 获取上半部分列表数据
export const codeTableListb =({
  rvDomain,
  rvName,
  rvTerId,
  PageIndexs,
  PageSizes
}) =>
  post(
    '/FTKJWLHYPT/base/getRefCodeTypeLike',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain,
            rvName,
            rvTerId
          }
        },
        Orderbys:{},
        PageIndexs:{
          FTKJWLHYPT:PageIndexs
        },
        PageSizes:{
          FTKJWLHYPT:PageSizes
        }
      }
    }
  )

// 上部分新增数据
export const addCodeTable = (data) =>
  post(
    '/FTKJWLHYPT/base/addRefCodeType',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain:data.rvDomain,
            rvTerId:data.rvTerId,
            rvName:data.rvName,
            rvType:data.rvType,
            rvLength:data.rvLength,

            rvInsertuser:store.state.user.USR_CODE_DX_H,
            // rvLstupduser:store.state.user.USR_CODE_DX_H,
            rvInsertdt:data.rvInsertdt,
            rvLstupddt:data.rvLstupddt,

            rvIsvalid:data.rvIsvalid,
            rvRemark:data.rvRemark
          }
        }
      }
    }
  )
  // 上部分编辑数据
export const editCodeTable = (data) =>
  post(
    '/FTKJWLHYPT/base/editRefCodeType',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain:data.rvDomain,
            rvTerId:data.rvTerId ,
            rvName:data.rvName,
            rvType:data.rvType,
            rvLength:data.rvLength,
            // rvInsertuser:store.state.user.USR_CODE_DX_H,
            rvInsertdt:data.rvInsertdt,
            rvLstupddt:data.rvLstupddt,
            rvLstupduser:store.state.user.USR_CODE_DX_H,
            rvIsvalid:data.rvIsvalid,
            rvRemark:data.rvRemark
          }
        }
      }
    }
  )
  // 上半部分删除数据
export const delCodeTable = data =>
  post(
    '/FTKJWLHYPT/base/delRefCodeType',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain:data.rvDomain,
            rvTerId:data.rvTerId,
          }
        }
      }
    }
  )


// 下半部分列表
export const codeTableListA = ({
  rvDomain,
  rvTerId,
  PageIndexs,
  PageSizes
}) =>
  post(
    '/FTKJWLHYPT/base/getRefCodesByType',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain,
            rvTerId,
          }
        },
        Orderbys: {},
        PageIndexs:{
          FTKJWLHYPT:PageIndexs
        },
        PageSizes:{
          FTKJWLHYPT:PageSizes
        }
      }
    }
  )

// 下半部分列表新增
export const addCodeTableA = data =>
  post(
    '/FTKJWLHYPT/base/addRefCodes',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain:data.rvDomain,
            rvLowValue:data.rvLowValue,
            rvTerId:data.rvTerId,
            rvCmeaning:data.rvCmeaning,
            rvEmeaning:data.rvEmeaning,
            rvHighValue:data.rvHighValue,
            rvEdicode:data.rvEdicode,
            rvIsvalid:data.rvIsvalid,
            rvInsertdt:data.rvInsertdt,
            rvInsertuser:store.state.user.USR_CODE_DX_H,
            rvLstupddt:data.rvLstupddt,
            rvLstupduser:store.state.user.USR_CODE_DX_H,
            rvDefault:data.rvDefault,
            rvRemark:data.rvRemark,
            rvType:data.rvType,
            rvQuee:data.rvQuee,
            rvTypew:data.rvTypew
          }
        },
      }
    }
  )

// 下半部分删除
export const delCodeTableA = data =>
  post(
    '/FTKJWLHYPT/base/delRefCodes',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain:data.rvDomain,
            rvLowValue:data.rvLowValue,
            rvTerId:data.rvTerId
          }
        },
      }
    }
  )
  // 下半部分列表编辑
export const editCodeTableA = data =>
  post(
    '/FTKJWLHYPT/base/editRefCodes',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain:data.rvDomain,
            rvLowValue:data.rvLowValue,
            rvTerId:data.rvTerId,
            rvCmeaning:data.rvCmeaning,
            rvEmeaning:data.rvEmeaning,
            rvHighValue:data.rvHighValue,
            rvEdicode:data.rvEdicode,
            rvIsvalid:data.rvIsvalid,
            rvInsertdt:data.rvInsertdt,
            rvInsertuser:store.state.user.USR_CODE_DX_H,
            rvLstupddt:data.rvLstupddt,
            rvLstupduser:store.state.user.USR_CODE_DX_H,
            rvDefault:data.rvDefault,
            rvRemark:data.rvRemark,
            rvType:data.rvType,
            rvQuee:data.rvQuee,
            rvTypew:data.rvTypew,
          }
        },
      }
    }
  )

// 下半部分新增里 下拉框数据
export const addCodeTableXL = () =>
  post(
    '/FTKJWLHYPT/base/getRefCodeTypeAll',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvTerId: '-1'
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT:''
        },
        PageSizes: {
          FTKJWLHYPT:''
        }
      }
    }
  )

/**
 * 重置密码用户接口
 */

export const changePwd = data =>
  post(
    '/DXNXTD/ControlPath?act=edit&actKey=SysUser&Section=EditSysUserPassword&SessionId=' +
      store.state.user.SessionId_DX_H,
    {
      Data: {
        Parameters: {
          DXNXTD: {
            UUID: data.UUID,
            VERSION: toString(data.VERSION),
            LASTMODIFIER: store.state.user.USR_CODE_DX_H,
            FLT_UUID: store.state.user.FLT_UUID_DX_H
          }
        }
      }
    }
  )

